# Contributor: Alex Laskin <alex@lask.in>
# Maintainer: John Vogel <jvogel@stygian.me>
pkgname=autofs
pkgver=5.1.9
pkgrel=0
pkgdesc="A kernel-based automounter for Linux"
url="https://www.kernel.org/pub/linux/daemons/autofs/"
arch="all"
license="GPL-2.0-or-later"
makedepends="
	automake
	bison
	coreutils
	flex
	libnfs-dev
	libtirpc-dev
	linux-headers
	rpcgen
	"
subpackages="$pkgname-dbg $pkgname-doc $pkgname-openrc"
options="!check" # no test suite provided
# autofs-5.1.9-c99.patch was retrieved from gentoo autofs ebuild
# musl.patch was retrieved from void autofs recipe
source="
	https://www.kernel.org/pub/linux/daemons/autofs/v5/autofs-$pkgver.tar.xz
	0001-auto.master-change-paths-in-etc.patch
	0002-add-include-for-basename.patch
	autofs-5.1.9-c99.patch
	musl.patch
	autofs.initd
	autofs.confd
	"

build() {
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--with-mapdir=/etc/autofs \
		--with-confdir=/etc/autofs \
		--without-hesiod \
		--with-libtirpc \
		--enable-ignore-busy \
		--enable-force-shutdown
	make STRIP=:
}

package() {
	make DESTDIR="$pkgdir" install

	# auto.master.d/ is referenced in auto.master
	install -m755 -d "$pkgdir"/etc/autofs/auto.master.d/
	install -m644 samples/autofs.conf.default.in \
		"$pkgdir"/etc/autofs/autofs.conf
	install -m644 samples/auto.master \
		samples/auto.misc \
		samples/auto.net \
		samples/auto.smb \
		"$pkgdir"/etc/autofs/

	install -m755 -D "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname

	install -m644 -D "$srcdir"/$pkgname.confd \
		"$pkgdir"/etc/conf.d/$pkgname
}

sha512sums="
81eb04270727c3fbf9dfb4b07a8dd39beac9068d6289f2f3bb0eabf723c14bec36860d3b2759c46b597bd77e8f3fa521646445e926c95ab63859a3a6c8588dcc  autofs-5.1.9.tar.xz
562607fb77347680740a73242390cd199595779acd96033b7b9b4579ef57e8fc887bbcee227964ffeda1710798becd58e957e28c4dd875f2402c9d3989a04aef  0001-auto.master-change-paths-in-etc.patch
5b7ccd5880dedc000a5468bd04e2ca8ab32cf0dd7d3f7234644818b90a6b15428d3f2361bef4a9877bb9cea87e0b5a647ad66213e938168cca5330348acdd5df  0002-add-include-for-basename.patch
4476c5a1ff41931d9852cd16dc98c040845ac193ef22cca64d86c14eb52064e40a2042101602cc4ae8bac6eaaf71783f2157bd58882434df70ad10e10742f862  autofs-5.1.9-c99.patch
67c03241ec1daea0855b225c12638860c17cfbc87b7a547cf79426f889e40cc5c8c3516f55c5e5ee0c25a7221eb750941dd4fe6690b36a050518384276279c93  musl.patch
762af446c0643dd97a64894a6c221e5dbf8e504df87831865db13f27047b224a2e37457ddf2197ae5a92761a7535428f37447a92d1e2e8c46e65405f187c633f  autofs.initd
95947629b91a77cfe5de6205de38d8c0f14699627549f2a7a89d961b6bce3bc2ae8453886765d6c342f2a3cca34d1c66f7c475a548a4ac6e902d2ab96fb69343  autofs.confd
"
